package net.mhelvens.deltaprofiles;


abstract public class PollerMonitor<T extends Object> extends BaseMonitor {
	@SuppressWarnings("unused") private static final String TAG = PollerMonitor.class.getSimpleName();
	
	private PollerThread thread;
    
	@Override
	protected synchronized void onStart() {
		thread = new PollerThread();
		thread.start();
	}

	@Override
	protected synchronized void onStop() {
		thread.interrupt();
		thread = null;
	}
	
	abstract protected long checkInterval();
	
	// TODO
	
	private class PollerThread extends Thread {
		@Override
		public void run() {
			while (true) {
				try {
					
					// TODO
					
					Thread.sleep(checkInterval());
				} catch (InterruptedException e) {
					break; // out of the infinite loop
				}
			}
		}
	}
}
